﻿@using Library
@model Dictionary<string, Library.MVCHelpers.SEOHelper.URLInfo>

@{
    ViewBag.Title = NOWCulture.GetString("URL list");
    Layout = "_Layout.cshtml";
}

<h2>@ViewBag.Title</h2>
@using (Html.BeginForm("UrlList", "Admin", FormMethod.Get, new { @id = "search-form", @class = "pull-right col-lg-6" }))
{
    <div class="input-group">
        <input type="text" name="keywords" class="form-control" placeholder="@NOWCulture.GetString("Search for...") @NOWCulture.GetString("URL")" value="@ViewBag.SearchingUrl">
        <span class="input-group-btn">
            <button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search"></span></button>
        </span>
    </div>
}
<div class="clearfix"></div>
<div class="table-responsive">
    <table class="table table-hover" id="url-list">
        <thead>
        <tr>
            <th>@NOWCulture.GetString("URL")</th>
            <th>@NOWCulture.GetString("URL type")</th>
            <th>@NOWCulture.GetString("Reference model ID")</th>
        </tr>
        </thead>
        <tbody id="url-list-tbody">
        @foreach (var url in Model)
        {
            if (string.IsNullOrWhiteSpace(ViewBag.SearchingUrl))
            {
                <tr>
                    <td>@url.Key</td>
                    <td>@NOWCulture.GetString(url.Value.URLType.ToDisplayString())</td>
                    <td>@url.Value.ModelId</td>
                </tr>
            }
            else if (url.Key.Contains(ViewBag.SearchingUrl))
            {
                <tr>
                    <td>@url.Key</td>
                    <td>@NOWCulture.GetString(url.Value.URLType.ToDisplayString())</td>
                    <td>@url.Value.ModelId</td>
                </tr>
            }
        }
        </tbody>
    </table>
</div>
@section scripts
{
    @(HttpContext.Current.IsDebuggingEnabled ? Scripts.Render("~/bundles/layout") : Scripts.RenderFormat(@"<script src=""{0}"" async defer></script>", "~/bundles/layout"))
}